package ink.tiptop.persist.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import ink.tiptop.persist.domain.bo.LocalViewDto;
import ink.tiptop.persist.domain.entity.ZjfServiceRemoteViewEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 服务远程视图(ZjfServiceRemoteView)表数据库访问层
 *
 * @author zjf
 * @since 2020-07-22 08:45:34
 */
@Mapper
public interface ZjfServiceRemoteViewMapper   extends BaseMapper<ZjfServiceRemoteViewEntity> {

    /**
     查找到已经关联到了的
     * @param ids
     * @return
     */
    @Select("     SELECT DISTINCT\n" +
            "        ( a.id )\n" +
            "        FROM\n" +
            "        zjf_base_server_info a\n" +
            "        INNER JOIN zjf_service_remote_view b ON a.id = b.server_id\n" +
            "        where a.id in ( ${ids} )")
    List<Integer> listRelatedIdList(@Param("ids")String ids);


    List<ZjfServiceRemoteViewEntity> queryByLocalView(LocalViewDto dto);
}